package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectMemberApi;
import com.nbsaas.boot.project.api.domain.request.ProjectMemberRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectMemberResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectMemberSimple;
import com.nbsaas.boot.project.data.entity.ProjectMember;
import com.nbsaas.boot.project.data.repository.ProjectMemberRepository;
import com.nbsaas.boot.project.rest.convert.ProjectMemberEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectMemberResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectMemberSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   项目成员-业务接口实现
 */
@Transactional
@Service
public class ProjectMemberResource extends BaseResource<ProjectMember, ProjectMemberResponse, ProjectMemberSimple, ProjectMemberRequest> implements ProjectMemberApi {

    @Resource
    private ProjectMemberRepository projectMemberRepository;

    @Override
    public JpaRepositoryImplementation<ProjectMember, Serializable> getJpaRepository() {
        return projectMemberRepository;
    }

    @Override
    public Function<ProjectMember, ProjectMemberSimple> getConvertSimple() {
        return new ProjectMemberSimpleConvert();
    }

    @Override
    public Function<ProjectMemberRequest, ProjectMember> getConvertForm() {
        return new ProjectMemberEntityConvert();
    }

    @Override
    public Function<ProjectMember, ProjectMemberResponse> getConvertResponse() {
        return new ProjectMemberResponseConvert();
    }


}


